// #define _CRT_SECURE_NO_WARNINGS 1 // use for depreate the warning error of scanf

#include <stdio.h>

int main(void)
{
	int Age, Gender; // Gender 1:male; 2:female
	float Height, Weight;
	printf("Please input your age:");
	scanf("%d", &Age);
	printf("Your age is %d\n", Age);
	printf("Please input your gender(Gender 1:male; 2:female):");
	scanf("%d", &Gender);
	if (Gender == 1)
	{
		printf("Your gender is male\n");
	}
	else
	{
		printf("Your gender is female\n");
	}

	printf("Please input your height(m):");
	scanf("%f", &Height);
	printf("Your height is %.2f m \n", Height);
	printf("Please input your weight(kg):");
	scanf("%f", &Weight);
	printf("Your weight is %.2f kg\n", Weight);

	float BMI;
	BMI = Weight / (Height * Height);
	printf("Your BMI is %.2f\n", BMI);
	// Adult
	if (Age >= 18)
	{
		if (Gender == 1)
		{
			if (BMI < 18.5)
			{
				printf("Your body shape is underweight");
			}
			else if (BMI >= 18.5 && (BMI < 24))
			{
				printf("Your body shape is fine");
			}

			else if (BMI >= 24 && (BMI < 28))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 28)
			{
				printf("Your body shape is obesity");
			}
		}
		if (Gender == 2)
		{
			if (BMI < 18)
			{
				printf("Your body shape is underweight");
			}
			else if ((BMI >= 18) && (BMI < 23.5))
			{
				printf("Your body shape is fine");
			}

			else if ((BMI >= 23.5) && (BMI < 27))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 27)
			{
				printf("Your body shape is obesity");
			}
		}
	}

	// Teenager
	if ((Age >= 10) && (Age < 18))
	{
		if (Gender == 1)
		{
			if (BMI < 17)
			{
				printf("Your body shape is underweight");
			}
			else if (BMI >= 17 && (BMI < 23.5))
			{
				printf("Your body shape is fine");
			}

			else if (BMI >= 23.5 && (BMI < 27))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 27)
			{
				printf("Your body shape is obesity");
			}
		}
		if (Gender == 2)
		{
			if (BMI < 16.5)
			{
				printf("Your body shape is underweight");
			}
			else if ((BMI >= 16.5) && (BMI < 23))
			{
				printf("Your body shape is fine");
			}

			else if ((BMI >= 23) && (BMI < 26.5))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 26.5)
			{
				printf("Your body shape is obesity");
			}
		}
	}

	// Child
	if ((Age >= 3) && (Age < 10))
	{
		if (Gender == 1)
		{
			if (BMI < 19)
			{
				printf("Your body shape is underweight");
			}
			else if (BMI >= 19 && (BMI < 24.5))
			{
				printf("Your body shape is fine");
			}

			else if (BMI >= 24.5 && (BMI < 29))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 29)
			{
				printf("Your body shape is obesity");
			}
		}
		if (Gender == 2)
		{
			if (BMI < 18.5)
			{
				printf("Your body shape is underweight");
			}
			else if ((BMI >= 18.5) && (BMI < 24))
			{
				printf("Your body shape is fine");
			}

			else if ((BMI >= 24) && (BMI < 28.5))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 28.5)
			{
				printf("Your body shape is obesity");
			}
		}
	}

	// Infant
	if (Age < 3)
	{
		if (Gender == 1)
		{
			if (BMI < 19.5)
			{
				printf("Your body shape is underweight");
			}
			else if (BMI >= 19.5 && (BMI < 25))
			{
				printf("Your body shape is fine");
			}

			else if (BMI >= 25 && (BMI < 29))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 29)
			{
				printf("Your body shape is obesity");
			}
		}
		if (Gender == 2)
		{
			if (BMI < 19)
			{
				printf("Your body shape is underweight");
			}
			else if ((BMI >= 19) && (BMI < 25))
			{
				printf("Your body shape is fine");
			}

			else if ((BMI >= 25) && (BMI < 29))
			{
				printf("Your body shape is overweight");
			}
			else if (BMI > 29)
			{
				printf("Your body shape is obesity");
			}
		}
	}

	return (0);
}
